<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
     *  方式一  Array()
     */
    let arr1 = Array(2).fill(null)
    let arr2 = new Array(2).fill(null)
    let arr3 = Array(1, 2, 3)
    console.log(arr1, arr2, arr3)

    /*
        方法二   []
     */
    let arr4 = [];
    console.log(arr4)

    /*
        方法三 Array.of()
     */
    let arr5 = Array.of(1, 2, 3)
    console.log(arr5)

    /*
        方法四 Array.from()
            - 传入可遍历对象
            - 或者类数组
     */
    let arr6 = Array.from([1, 2, 3])
    let arr7 = Array.from({length: 4})
    console.log(arr6,arr7)
</script>
</body>
</html>